<template>
  <ul class="vue-tree">
    <TreeItem
      v-for="(item, index) in treeData"
      :key="index"
      :tree-item-data="item"
      :tree-click-event="treeClickEvent"
      :name-key="nameKey"
      :children-key="childrenKey"
    />
  </ul>
</template>

<script>
import TreeItem from './TreeItem';
export default {
  name: 'VueTreeMenu',
  components: {
    TreeItem
  },
  props: {
    // 树形控件数据
    nameKey: {
      type: String,
      default: 'text'
    },
    childrenKey: {
      type: String,
      default: 'ftmAtaChapter'
    },
    treeData: {
      type: Array,
      default() {
        return [];
      }
    },
    // 节点点击事件
    treeClickEvent: {
      type: Function,
      default() {
        return function() {};
      }
    }
  }
};
</script>

<style lang="less">
@import './index.less';
</style>
